package com.market.remote;

import com.market.common.core.constant.ServiceNameConstants;
import com.market.common.core.domain.Result;
import com.market.order.common.domain.TOrder;
import com.market.order.common.domain.TOrderDetail;
import com.market.remote.factory.RemoteOrderServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>ClassName：RemoteOrderService</p >
 * <p>Description：</p >
 * <p>Author：liuchang</p >
 * <p>Date：2024/2/27</p >
 */
@FeignClient(contextId = "remoteOrderService",value = ServiceNameConstants.MARKET_SERVICE,fallbackFactory = RemoteOrderServiceFallbackFactory.class)
public interface RemoteOrderService {
    /*
    * 新增订单
    * */
    @PostMapping("/order")
    public Result add(@RequestBody TOrder tOrder);
    /*
    * 新增订单详情
    * */
    @PostMapping("/orderDetail")
    public Result addDetail(@RequestBody TOrderDetail tOrderDetail);

    /*
    * 根据orderId查询订单详情
    * */
    @PostMapping(value = "/orderDetail/getDetailInfo/{orderId}")
    public Result<List<TOrderDetail>> getDetailInfo(@PathVariable("orderId") Integer orderId);

    /*
    * 订单状态修改
    * */
    @PostMapping("/order/updateOrderStatus")
    public Result updateOrderStatus(@RequestParam("orderId") Integer orderId, @RequestParam("orderStatus") Integer orderStatus);

    @PostMapping("/order/sendMsg/{phone}")
    public Result sendMsg(@PathVariable("phone") String phone);

    @PostMapping("/order/addOrder")
    public Result addOrder(@RequestBody TOrder tOrder);
}
